package org.laobai.shop.goods.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.dubbo.config.annotation.DubboService;
import org.laobai.shop.goods.entity.Brand;
import org.laobai.shop.goods.mapper.BrandMapper;
import org.laobai.shop.goods.service.BrandService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


@DubboService
public class BrandServiceImpl implements BrandService {

    @Autowired
    private BrandMapper brandMapper;

    @Override
    public PageInfo<Brand> page(int cp, int ps, Brand brand) {
        PageHelper.startPage(cp, ps);
        List<Brand> list = brandMapper.list(brand);
        return new PageInfo<>(list);
    }

    @Override
    public boolean save(Brand brand) {
        // 设置未删除状态
        brand.setDeletedFlag(0);
        int i = brandMapper.save(brand);
        return i > 0;
    }
}
